package com.citybox.type.enums;

import lombok.Getter;

@Getter
public enum GlobalEnum {

    GLOBAL_ENUM_Y("Y","是"),

    GLOBAL_ENUM_N("N","否"),
    ;
    private final String code;
    private final String value;

    private GlobalEnum(final String code, final String value) {
        this.code = code;
        this.value = value;
    }

    public static GlobalEnum getByCode(final String code) {
        for (GlobalEnum mode : values()) {
            if (mode.code.equals(code)) {
                return mode;
            }
        }
        return null;
    }

    public static String getValueByCode(final String code) {
        for (GlobalEnum mode : values()) {
            if (mode.code.equals(code)) {
                return mode.getValue();
            }
        }
        return null;
    }

}
